import {createRouter, createWebHistory} from "vue-router";

const routes = [
    {
        path: '/login',
        name: 'Login',
        meta: {title: '登录'},
        component: () => import('@/views/login/index.vue'),
    },
    {
        path: '/register',
        name: 'Register',
        meta: {title: '注册'},
        component: () => import('@/views/register/index.vue'),
    },
    {
        path: '/',
        name: 'Index',
        component: () => import('@/views/index.vue'),
        redirect: '/home',
        children: [
            {
                path: '/home',
                name: 'Home',
                component: () => import('@/views/home/index.vue'),
                meta: {title: '首页'},
            },
            {
                path: '/contact',
                name: 'Contact',
                component: () => import('@/views/contact/index.vue'),
                meta: {title: '联系我'},
            },
            {
                path: '/about',
                name: 'About',
                component: () => import('@/views/about/index.vue'),
                meta: {title: '关于我'},
            },
        ]
    },
]

const router = createRouter({
    routes,
    history: createWebHistory(),
})

export default router
